import workManagement from "@/api/workManagement/index";
export default {
    data() {
        return {
            isSelect:false,
            select_key:"",
            select_url:"",
            approverInfo:{
              visible:false,
              datalist:[],
              showCheckbox:false,
              key:""
            },
            unSelectCallback:()=>{},
        }
    },
    created() {
    },
    methods: {
        setApprover(data) {
            this.info[this.approverInfo.key?this.approverInfo.key:"dept_approver"] = data.username
            this.approverInfo.visible = false
            this.unSelectCallback()
        },
        getIsSelect(name,unSelectCallback){
            this.unSelectCallback=unSelectCallback
            workManagement.workflowsIsSelect({name:name}).then(res=>{
              this.isSelect = res.data.is_select
              this.approverInfo.key = res.data.select_key
              this.select_url = res.data.select_url
              this.approverInfo.showCheckbox = res.data.select_checkbox
              if(this.isSelect){
                workManagement.getSomething(this.select_url).then(res => {
                  this.approverInfo.dataList = res.data
                  this.approverInfo.visible = true
                })
              }else{
                this.$confirm("提交后不可修改，确定提交?", "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
                }).then(() => {
                  this.unSelectCallback()
                });
              }
            })
        }
    }
}
